package com.zhongfl.crm.model.boss;

import com.zhongfl.crm.enums.boss.OrderConfirmStatus;
import com.zhongfl.crm.enums.boss.OrderConfirmType;
import com.zhongfl.crm.enums.boss.ReasonType;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * 订单确认表
 * @Author: mawenlei
 * @Date: 2018/7/29
 */
@Data
public class OrderConfirm implements Serializable {
    /**
     * 自增ID
     */
    private Integer id;

    /**
     * 审批编号
     */
    private String  approvalNo;

    /**
     * 定单号
     */
    private String orderNo;

    /**
     * 确认巴长的编码
     */
    private String approverStaffCode;

    /**
     * 确认巴长的名称
     */
    private String approverStaffName;


    /**
     * 申请人的名称
     */
    private String applicantStaffName;


    /**
     * 申请人的编码
     */
    private String applicantStaffCode;



    /**
     * 是否确认状态
     */
    private OrderConfirmStatus status;

    /**
     * 确认类型 比如一次性通过
     */
    private OrderConfirmType confirmType;

    private String confirmTypeName;

    public String getConfirmTypeName(){
        if(Objects.nonNull(confirmType)){
            return confirmType.getDesc();
        }else{
            return "";
        }
    }

    /**
     * 确认时间
     */
    private Date confirmTime;

    /**
     * 逻辑删除标记 0未删1已删
     */
    private Byte deleted;

    /**
     * 创建人
     */
    private String createdBy;

    /**
     * 创建时间
     */
    private Date createdTime;

    /**
     * 最后更新人
     */
    private String modifiedBy;

    /**
     * 更新时间
     */
    private Date modifiedTime;

    /**
     * 结束时间
     */
    private Date endTime;

    /**
     * 是否一次性批贷
     */
    private Integer passByOneTime;

    /**
     * 是否一次性放款
     */
    private Integer oneTimeLoaned;

    /**
     * 非一次性通过原因
     */
    // approve_reason
    private ReasonType reasonType;


    private String  approveReasonName;

    public String getApproveReasonName(){
        if(Objects.isNull(approveReasonName) || StringUtils.isEmpty(approveReasonName)){
            return "";
        }
        return  ReasonType.valueOf(approveReasonName).getValue();
    }

    private String loanedReasonName;

    public String getLoanedReasonName(){
        if(Objects.isNull(loanedReasonName) || StringUtils.isEmpty(loanedReasonName)){
            return "";
        }
        return  ReasonType.valueOf(loanedReasonName).getValue();
    }

    /**
     * 房本入库时间
     */
    private Date houseEntryTime;

    private static final long serialVersionUID = 1L;

    private String name;

    private String deliverManager;

    private String businessManager;

    private Integer  applicantPassByOneTime;

    private String applicantAvatar;

    private String approverAvatar;

    private List<OrderConfirm> orderConfirms;

    private Integer count;

    private String staffCode;

    private String waitTime;

    private List<ApproverUser> approverUsers;

    private String approverStaffCodeList;

}
